package cz.muni.fi.pb138.odsKartW;

/**
 * Class represents title on the medium (movie, game, music).
 * 
 * @author Michal Sorentiny
 * @version 05/05/2011
 */
public class Title {
    
    private String name;

    public Title() {
    }

    /**
     * Constructor for a new Title with given name.
     * @param name name of the title
     */
    public Title(String name) {
        if (name == null) {
            throw new IllegalArgumentException("name");
        }
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Title other = (Title) obj;
        if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 97 * hash + (this.name != null ? this.name.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "Title{" + "name=" + name + '}';
    }
    
}
